<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //1.键盘被松开时触发
        document.addEventListener('keyup', function () {
            console.log('我弹起了');
        })
        // 2.keydown键盘被按下时触发
        document.addEventListener('keydown',function(){
            console.log('我按下了keydown');
        })
        // 3.keypress键盘被按下时触发 但是它不识别功能键 比如左右箭头和shift 和CTRL键
        document.addEventListener('keypress',function(){
            console.log('我按下了keypress');
        })
    </script>
</body>

</html>